package main

import (
	"gopkg.in/yaml.v2"
	"io/ioutil"
	"log"
)

//type Config struct {
//	//Global        map[string]string `yaml:"global"`
//	ScrapeConfigs []Job `yaml:"scrape_configs"`
//}
//
//type Job struct {
//	Name          string   `yaml:"job_name"`
//	StaticConfigs []Target `yaml:"static_configs"`
//}

//type Target struct {
//	Targets []string          `yaml:"targets"`
//	Labels  map[string]string `yaml:"labels"`
//}

func main0() {
	/// Open the YAML file
	//file, err := ioutil.ReadFile("E:\\application\\开发环境归档\\hdm.yml")
	file, err := ioutil.ReadFile("E:\\application\\开发环境归档\\omc-prometheus-collector\\overlays\\tempnode\\tempregion\\omc-prometheus-collector-0.yaml")
	if err != nil {
		log.Fatalf("Failed to read file: %v", err)
	}

	// Parse the YAML file into the Config struct
	var config Config
	err = yaml.Unmarshal(file, &config)
	if err != nil {
		log.Fatalf("Failed to parse YAML: %v", err)
	}

	// Access the data from the Config struct
	//fmt.Println(config.ScrapeConfigs[0].Name)
	//fmt.Println(config.ScrapeConfigs[3].StaticConfigs[0].Targets[0])
}
